Enhance FIT image packaging: helper invocation, executable permissions, artifact rename, sector size configurability, and prerequisite installation#33
Conversation
Summary:
- Updated script header to accurately reflect supported arguments:
* Replaced incorrect `--dtb` with `--metadata`
* Fixed typo `--kob` → `--kobj`
* Added default paths for clarity in options section
- Improved invocation of helper script `generate_boot_bins.sh`:
* Use absolute path based on this script’s directory (`SELF_DIR`) to avoid PATH dependency
* Ensures consistent execution regardless of current working directory
Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
- Set executable permissions for build scripts: * chmod +x kmake-image/make_fitimage.sh * chmod +x kmake-image/generate_boot_bins.sh
Update make_fitimage.sh to rename final packaged image from fit_dtb.bin to dtb.bin for consistency with naming conventions. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Introduce a global `--sector-size BYTES` flag that can be specified before the command (`dtb` or `bin`). When present, it overrides the mkfs.vfat logical sector size; when absent, the script retains the existing default `-S 512`. This keeps current behavior unchanged while allowing callers to produce FAT images with non-512 logical sectors when required by tooling or platform constraints. Usage examples: # DTB image with default sector size (512 bytes) ./generate_boot_bins.sh dtb --input out/combined.dtb --output out # DTB image with 4096-byte sectors ./generate_boot_bins.sh --sector-size 4096 dtb --input out/combined.dtb --output out # BIN image with default sector size (512 bytes) ./generate_boot_bins.sh bin --input out/fit_dir --output out/dtb.bin # BIN image with 4096-byte sectors ./generate_boot_bins.sh --sector-size 4096 bin --input out/fit_dir --output out/dtb.bin No changes to image layout or content; only mkfs.vfat invocation is adjusted. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
…helper Introduce a new `--sector-size BYTES` argument to make_fitimage.sh that controls the logical sector size used when packaging the final FAT image. The value is forwarded as a global flag to generate_boot_bins.sh. When not provided, the script defaults to 512 bytes to preserve existing behavior. Usage examples: # Default 512-byte sectors ./make_fitimage.sh --metadata <path>/qcom-metadata.dts --its <path>/qcom-fitimage.its # Explicit 4096-byte sectors ./make_fitimage.sh --sector-size 4096 --metadata <path>/qcom-metadata.dts --its <path>/qcom-fitimage.its No functional changes to FIT generation; only the final FAT image formatting is affected via mkfs.vfat sector size. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
Add a conditional apt-get install step for required tools: - device-tree-compiler (provides `dtc` for DTS → DTB compilation) - u-boot-tools (provides `mkimage` for FIT image generation) This step runs only if `apt-get` is available and script executes as root, ensuring the environment has the necessary utilities before proceeding. Improves robustness in CI and containerized builds. Signed-off-by: Bjordis Collaku <bcollaku@qti.qualcomm.com>
| echo "Ensuring prerequisites are installed: device-tree-compiler, u-boot-tools" | ||
| export DEBIAN_FRONTEND=noninteractive | ||
| apt-get update -y | ||
| apt-get install -y device-tree-compiler u-boot-tools |
There was a problem hiding this comment.
The Dockerfile already installs u-boot-tools; you could also include device-tree-compiler there.
There was a problem hiding this comment.
Both device-tree-compiler AND u-boot-tools are mandatory for the tool to execute, so until BOTH are included in Dockerfile definition, it's a must to have the tool install those as pre-req.
At the same time, there is no harm in having those there, taking in consideration support for local developer workflows independent of docker usage?
There was a problem hiding this comment.
At the same time, there is no harm in having those there, taking in consideration support for local developer workflows independent of docker usage?
Absolutely, I agree with your point
| SELF_DIR="$(dirname "$(realpath "$0")")" | ||
|
|
||
| # Pass sector size to helper (global option). If SECTOR_SIZE is empty, default to 512 earlier. | ||
| "${SELF_DIR}/generate_boot_bins.sh" --sector-size "${SECTOR_SIZE}" bin \ |
There was a problem hiding this comment.
It won’t work if someone is running from the Docker image.
There was a problem hiding this comment.
This makes us rely on the source file to run, which kind of undermines the whole point of using Docker—to avoid depending on local compilation.
There was a problem hiding this comment.
Komal, we need to get these changes merged for tooling to be usable, can you elaborate why would this particular block break if invoked from docker? Did you test using docker?
This PR introduces multiple improvements to the FIT image packaging mechanism:
Script header and argument fixes
--dtbto--metadatafor clarity.--kob→--kobj.Helper script invocation improvements
generate_boot_bins.shbased on the caller script’s directory.PATHto ensure consistent execution across environments.Executable permissions
chmod +x kmake-image/make_fitimage.shchmod +x kmake-image/generate_boot_bins.shArtifact naming
fit_dtb.bintodtb.binfor consistency with downstream consumers and flashing tools.Sector size configurability
--sector-size <bytes>option togenerate_boot_bins.sh(default:512).dtb,bin,efi) in the invocation.--sector-size <bytes>argument tomake_fitimage.sh(default:512).generate_boot_bins.shfor FAT image creation.Prerequisite installation
apt-get installstep inmake_fitimage.shfor required tools:device-tree-compiler(providesdtc)u-boot-tools(providesmkimage)apt-getis available and script executes as root.Rationale
PATHfor helper script invocation caused failures when executed from different directories.Impact
fit_dtb.binmust be updated todtb.bin.512when required.Usage Examples
Default sector size (512 bytes):
Custom sector size (4096 bytes):